﻿using System;
using System.Drawing;
using System.Windows.Forms;
using GeekShop.Tools;

namespace GeekShop
{
    public abstract class MenuObject
    {
        #region Fields
        private ToolStripItem menuItem;
        private ToolStripItem toolItem;
        private bool showAsToolBar = true;
        #endregion

        #region Properties
        public ToolStripItem ToolItem
        {
            get { return toolItem; }
            set { toolItem = value; }
        }
        public ToolStripItem MenuItem
        {
            get { return menuItem; }
            set { menuItem = value; }
        }
        #endregion

        #region Virtual Properties
        public string Text
        {
            get { return this.menuItem.Text; }
            set
            {
                this.menuItem.Text = value;
                this.toolItem.Text = value;
            }
        }
        public Image Image
        {
            get { return this.menuItem.Image; }
            set
            {
                this.menuItem.Image = value;
                this.toolItem.Image = value;
                this.toolItem.DisplayStyle = ToolStripItemDisplayStyle.Image;
            }
        }
        public EventHandler OnClick
        {
            set
            {
                this.menuItem.Click += value;
                this.toolItem.Click += value;
            }
        }
        public bool ShowAsMenuBar
        {
            get { return this.menuItem.Visible; }
            set { this.menuItem.Visible = value; }
        }
        public bool ShowAsToolBar
        {
            get { return this.showAsToolBar; }
            set
            {
                this.showAsToolBar = value;
                this.toolItem.Visible = value;
            }
        }
        #endregion
    }
}
